<div class="maintop">
    当前位置：房间管理
    <a href="javascript:;" action="/rooms/rooms_add?<?=$this->page_url($page_current,$page_url)?>" class="mainFrame button icon-plus">添加</a>
    <a href="javascript:;" action="<?=$basepath?>?<?=$this->page_url($page_current,$page_url)?>" id="btn_refresh" class="mainFrame button">刷新</a>
    <? if(ISDEBUG){ ?>
        <a href="javascript:$('.debuginfo').toggle();" class="button">调试信息</a>
    <? } ?>
    <a href="javascript:;" action="<?=$basepath?>_update_redis" class="mainFrame button">更新缓存</a>
</div>
<div class="main-search">
    <table width="100%">

        <tbody><tr>
            <td>
                <form action="<?=$basepath?>" id="brandsSearch" method="get" target="ajax" dataType="html" onajax="beforeSearchForm" call="searchForm" container="#iframe" isLoad="true">
                    <input type="text" id="sKey" name="sKey" class="int" placeholder="搜索关键字">
                    <input type="submit" value="搜索" class="upbutton">
                    <input action="<?=$basepath?>_delete_list" type="button" id="deleteSelectId" value="删除选择" class="upbutton">
                </form>
            </td>
        </tr>
        </tbody>

    </table>
</div>
<div id="mainbody">
    <table width="100%" class="tablist">
        <tr class="trbg">
            <th><input id="selectAllid" type="checkbox" value="1" /></th>
            <th width="40">图标</th>
            <th>商品名称</th>
            <th>房间说明</th>
            <th width="40">玩家</th>
            <th width="40">清屏</th>
            <th width="40">热门</th>
            <th width="40">禁言</th>
            <th width="40">状态</th>
            <th width="50">排序</th>
            <th width="60">操作</th>
        </tr>
        <? foreach($datas as $v){ ?>
            <tr>
                <td width="30"><input type="checkbox" name="selectValue" value="<?=$v['id']?>" /></td>
                <td><a href="/rooms/rooms_list_push?id=<?=$v['id']?>" class="mainFrame" target="ajax" func="loadpage" method="get"><img src="<?=($v['icon']!="#" ? $v['icon'] : IMG.'nopic.png') ?>" height="16" border="16" /></a></td>
                <td class="tdleft"><?=$v['name']?></td>
                <td class="tdleft"><?=$v['explain']?></td>
                <td><a action="/rooms/rooms_userlist?roomid=<?=$v['id']?>"  href="javascript:;" class="mainFrame upbutton icon-user"></a></td>
                <td><a href="/rooms/rooms_clearcontent?roomid=<?=$v['id']?>" target="ajax" func="loadpage" class="mainFrame upbutton icon-ccw"></a></td>
                <td><?=$this->toggleButton($basepath,$v['id'],'hot',$v['hot'],$page_current,$page_url)?></td>
                <td><?=$this->toggleButton($basepath,$v['id'],'nosay',$v['nosay'],$page_current,$page_url)?></td>
                <td><?=$this->toggleButton($basepath,$v['id'],'state',$v['state'],$page_current,$page_url)?></td>
                <td><?=$v['sort']?></td>
                <td>
                    <a action="<?=$basepath?>_delete?id=<?=$v['id']?>&title=<?=$v['name']?>" title="删除" class="mainFrame button icon-trash-2" href="javascript:;"></a>
                    <a action="<?=$basepath?>_edit?id=<?=$v['id']?>" title="编辑" class="mainFrame button icon-edit" href="javascript:;"></a>
                </td>
            </tr>
        <? } ?>
    </table>
    <? require VIEW.'/page.view.php' ?>
</div>
<script type="text/javascript">
    function beforeSearchForm(){
        var _key = this.sKey.value;
        if(_key.length<=0){
            throw '搜索关键字不能为空';
        }
    }
    function searchForm(self, _html, data){
        $("#iframe").html(_html);
    }
    $(document).ready(function(){
        <?php
        if(!empty($searchdata['categoryid'])){
            echo '$("#categoryid option[value=\''.$searchdata['categoryid'].'\']").attr("selected", "selected");';
        }
        if(!empty($searchdata['categorysubid'])){
            echo '$("#categorysubid option[value=\''.$searchdata['categorysubid'].'\']").attr("selected", "selected");';
        }
        if(!empty($searchdata['sKey'])){
            echo '$("#sKey").val("'.$searchdata['sKey'].'");';
        }
        ?>
    });
</script>
